<template>
    <div id="tmpl">
        <div class="title">
            <h4 v-text="data.title"></h4>
            <p>{{data.add_time | format('YYYY-MM-DD HH:mm:ss')}} {{data.click}}次浏览</p>
        </div>
        <div class="content" v-html="data.content">

        </div>
        <comment :id="newid"></comment>
    </div>
</template>
<script>
    import {Toast} from 'mint-ui';
    import common from '../../kits/common.js';
    import comment from '../subcom/comment.vue'


    export default {
        components:{
            comment:comment
        },
        data:function(){
            return{
                data:'',
                newid:0,
            }
        },
        created:function(){
            this.newid=this.$route.params.id;
            this.getdata()
        },
        methods:{
            getdata:function(){
                var url = common.apidomain+'/api/getnew/'+this.newid;
//                return data=1
                this.$http.get(url).then(function(response){
                    var body = response.body ;
                    if(body.status!=0){
                        Toast(body.message);
                        return;
                    }
                    this.data=body.message[0];
                })
            }
        }
    }
</script>
<style scoped>

    .title{
        border-bottom:1px solid #b6b6b6;
        border-top:1px solid #b6b6b6;
        padding-left: 10px;
        margin-bottom: 10px;
    }
    .title h4{
       color: #009999;
    }
    .title p{
        font-size: 12px;
        margin-top:1em;
    }
    .content{
        margin-left: 15px;
    }
</style>